package com.jelly.web.modules.system.quartz.task;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @创建人 ql
 * @创建时间 2018-09-26 18:22
 * @项目名称 jelly
 * @功能描述: 定时任务
 **/
@Configuration
@Component
@EnableScheduling
public class ScheduleTask2 implements Job {

    private static Logger logger = LoggerFactory.getLogger(ScheduleTask2.class);

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            System.out.print("任务执行2 :");
            System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

        } catch (Exception e) {
            logger.error(e.getMessage());
        }
    }

}
